package com.dayuanit.dy15.lesson20.demo2;

public class Test3 {
    public static void main(String[] args) {
        Dog dog = new Dog();
        dog.hashCode();

        Object object = new Object();
        object = dog;//多态

        Dog dog1 = new Dog();
        Dog dog2 = new Dog();

        //== 比较的是内存地址
//        System.out.println(dog1 == dog2);//false
//        System.out.println(dog1 == dog1);//true
//
//        System.out.println(dog1.equals(dog2));//false
//
//        System.out.println("-----------------");

        Dog dog3 = new Dog("wc001", 100);
        Dog dog4 = new Dog("wc001", 200);
        System.out.println(dog3 == dog4);//false
        System.out.println("dog3&dog4=" + dog3.equals(dog4));//fales

//        dog3.equals(null);//NPE异常

//        dog3.equals(new Cat());//ClassCastException
        System.out.println(dog3.equals(new Cat()));

        System.out.println(dog3.equals(dog3));

        // 2==2  2<3

//        System.out.println("------------------------");
//        String s1 = new String("tom");
//        String s2 = new String("tom");
//        System.out.println(s1 == s2);//
//        System.out.println(s1.equals(s2));

        //休息5分钟....


    }
}
